@isTest
private class LinktoContact_Test
{

static  testMethod  void LinktoConttest()
{
test.startTest();
string attcon1;
string iogcon1;
List<RecordType> lstRectype = [SELECT Id,Name FROM RecordType WHERE SobjectType='Contact' and name in('ATT Professional','IOG Contact')];
for(RecordType rectype:lstRectype)
{
if(rectype.name=='ATT Professional')
attcon1=rectype.Id;
if(rectype.name=='IOG Contact')
iogcon1=rectype.Id;
}
RecordType rec2=[Select Id From RecordType where SobjectType='Account' and IsActive=true and  Name='AAS Sales Account'] ;
Account acc1 = new Account();
acc1.RecordTypeId =rec2.Id;
acc1.Name = 'MasteraccountTest';
insert acc1;

 Case c = new Case();
      c.Subject = 'test';
      c.Origin = 'Email';
      c.Status ='open';
      c.AccountId=acc1.Id;
insert c;
Contact cont=new Contact(RecordtypeId=iogcon1,AccountId=acc1.Id,Phone='9877654443',MailingState='test',MailingCity='test',LastName='test',FirstName='test1',Email='test@test.com');
insert cont;
ApexPages.currentPage().getParameters().put('AccountId', acc1.Id);
ApexPages.currentPage().getParameters().put('Linkcon', cont.Id);
ApexPages.currentPage().getParameters().put('CaseId',c.Id);

LinktoContact linkcon=new LinktoContact();
linkcon.Link();
linkcon.AddContact();
List<WrperLinktoContact> lstWrperLinktoContact1=new List<WrperLinktoContact>();
Contact cont2=new Contact(RecordtypeId=iogcon1,Phone='9877654443',MailingState='test',MailingCity='test',LastName='test',FirstName='test1',Email='test@test2.com');
WrperLinktoContact wper=new WrperLinktoContact(cont2);
wper.selRectype=iogcon1;
lstWrperLinktoContact1.add(wper);
linkcon.lstWrperLinktoContact=lstWrperLinktoContact1;
linkcon.AddContact();

List<WrperLinktoContact> lstWrperLinktoContact2=new List<WrperLinktoContact>();
Contact cont3=new Contact(RecordtypeId=attcon1,Phone='9877654443',MailingState='test',MailingCity='test',LastName='test',FirstName='test1',Email='test@test2.com');
WrperLinktoContact wper2=new WrperLinktoContact(cont3);
wper2.selRectype=attcon1;
lstWrperLinktoContact2.add(wper2);
linkcon.lstWrperLinktoContact=lstWrperLinktoContact2;
linkcon.AddContact();

linkcon.Cancel();
test.stopTest();
WrperLinktoContact wrper=new WrperLinktoContact(cont);
wrper.getRecTypeitem();
wrper.getSyncLock();

}
}